package fr.paris.lutece.plugins.techos.service.chat;

import javax.inject.Inject;
import javax.inject.Named;

import fr.paris.lutece.plugins.genericjpa.dao.GenericJPADAO;
import fr.paris.lutece.plugins.genericjpa.service.GenericJPAService;
import fr.paris.lutece.plugins.techos.bean.chat.Chat;
import fr.paris.lutece.plugins.techos.dao.chat.IChatDAO;


/**
 * The Chat class service
 * @author jchaline
 */
public class ChatService extends GenericJPAService<Integer, Chat> implements IChatService
{

    @Inject
    @Named( "techos.chatDAO" )
    private IChatDAO _daoChat;

    @SuppressWarnings( "unchecked" )
    @Override
    protected GenericJPADAO<Integer, Chat> getDAO( )
    {
        return (GenericJPADAO<Integer, Chat>) _daoChat;
    }

    @Override
    public Chat findByStrPrimaryKey( String primaryKey )
    {
        Chat bean = null;
        try
        {
            Integer key = Integer.valueOf( primaryKey );
            bean = _daoChat.findById( key );
        }
        catch ( NumberFormatException e )
        {

        }
        return bean;
    }
}